<div id="soar_page_trace" style="position:fixed;bottom:0;right:0;font-size:14px;width:100%;z-index: 999999;color: #000;text-align:left;font-family:'微软雅黑';">
    <div id="soar_page_trace_tab" style="display: none;background:white;margin:0;height: 400px;">
        <div id="soar_page_trace_tab_tit" style="height:30px;padding: 6px 12px 0;border-bottom:1px solid #ececec;border-top:1px solid #ececec;font-size:16px">
            <span style="color:#000;padding-right:12px;height:30px;line-height:30px;display:inline-block;margin-right:3px;cursor:pointer;font-weight:700">Soar</span>
        </div>
        <div id="soar_page_trace_tab_cont" style="overflow:auto;height:362px;padding:0;line-height: 24px">
            <div style="display:none;">
                <?php foreach ($soars as $k => $val) {?>
                    <details>
                    <summary><?php echo $k.'. '.$val['sql'].' ['.$val['star'].'] '.$val['run_time'];?></summary>
                    <?php echo $val['score'];?>
                    <?php echo array_key_exists('htmlExplain', $val) ?$val['htmlExplain']:'';?>
                    </details>
                <?php }?>
            </div>
        </div>
    </div>
    <div id="soar_page_trace_close" style="display:none;text-align:right;height:15px;position:absolute;top:10px;right:12px;cursor:pointer;"><img style="vertical-align:top;" src="" /></div>
</div>

<div id="soar_page_trace_open" style="height:30px;float:left;text-align:left;overflow:hidden;position:fixed;bottom:0;left:0;color:#000;line-height:30px;cursor:pointer;">
    <img height="30" alt="Soar" title="Soar" src="">
</div>
<style>
    #soar_page_trace_tab_cont h1 {font-size:24px;}
    #soar_page_trace_tab_cont h2 {font-size:21px;}
    #soar_page_trace_tab_cont h3 {font-size:18px;}
    #soar_page_trace_tab_cont h4 {font-size:15px;}
    #soar_page_trace_tab_cont p {font-size:12px;}
    body {margin:0px auto;width:100%;};
    #soar_page_trace_tab_cont body {margin:20px auto;width:800px;background-color:#fff;font:13px "Myriad Pro","Lucida Grande",Lucida,Verdana,sans-serif}
</style>
<script type="text/javascript">
    (function(){
        var tab_tit  = document.getElementById('soar_page_trace_tab_tit').getElementsByTagName('span');
        var tab_cont = document.getElementById('soar_page_trace_tab_cont').getElementsByTagName('div');
        var open     = document.getElementById('soar_page_trace_open');
        var close    = document.getElementById('soar_page_trace_close').children[0];
        var trace    = document.getElementById('soar_page_trace_tab');
        var cookie   = document.cookie.match(/thinkphp_show_page_trace=(\d\|\d)/);
        var history  = (cookie && typeof cookie[1] != 'undefined' && cookie[1].split('|')) || [0,0];
        open.onclick = function(){
            trace.style.display = 'block';
            this.style.display = 'none';
            close.parentNode.style.display = 'block';
            history[0] = 1;
            document.cookie = 'thinkphp_show_page_trace='+history.join('|')
        }
        close.onclick = function(){
            trace.style.display = 'none';
            this.parentNode.style.display = 'none';
            open.style.display = 'block';
            history[0] = 0;
            document.cookie = 'thinkphp_show_page_trace='+history.join('|')
        }
        for(var i = 0; i < tab_tit.length; i++){
            tab_tit[i].onclick = (function(i){
                return function(){
                    for(var j = 0; j < tab_cont.length; j++){
                        tab_cont[j].style.display = 'none';
                        tab_tit[j].style.color = '#999';
                    }
                    tab_cont[i].style.display = 'block';
                    tab_tit[i].style.color = '#000';
                    history[1] = i;
                    document.cookie = 'thinkphp_show_page_trace='+history.join('|')
                }
            })(i)
        }
        parseInt(history[0]) && open.click();
        tab_tit[history[1]].click();
    })();
</script>
